<template>
    <div>
        <h2>用户管理</h2>
    </div>
    <div>
        <el-row :gutter="24">
            <el-col :span="20">
                用户名:<el-input v-model="input" style="width: 240px" placeholder="请输入" />
            </el-col>
            <el-col :span="2">
                <el-button>重置</el-button>
            </el-col>
            <el-col :span="2">
                <el-button type="primary" @click="search()">查询</el-button>
            </el-col>
        </el-row>
    </div>

    <el-row :gutter="24">
        <el-col :span="20">
            <span>用户信息</span>
        </el-col>

        <el-col :span="1">
            <el-button type="primary">
                <el-icon>
                    <Plus />
                </el-icon>

            </el-button>

        </el-col>
        <el-col :span="1">
            <el-button type="primary">
                <el-icon>
                    <Plus />
                </el-icon>

            </el-button>

        </el-col>
        <el-col :span="1">
            <el-button type="primary">
                <el-icon>
                    <Plus />
                </el-icon>

            </el-button>

        </el-col>
    </el-row>



    <el-table :data="tableData" stripe style="width: 100%">
        <el-table-column prop="date" label="序号" />
        <el-table-column prop="userName" label="用户名" />
        <el-table-column prop="nickName" label="昵称" />
        <el-table-column prop="image" label="头像" />
        <el-table-column prop="gender" label="性别" />
        <el-table-column prop="address" label="地址" />
        <el-table-column prop="Integral" label="积分" />
        <el-table-column prop="operate" label="操作" width="180" />
    </el-table>
</template>

<script setup>

import axios from 'axios';
import { ref } from "vue";
const tableData = ref([])

// 用户列表
let userName = localStorage.getItem("username")
let nickName = localStorage.getItem("nickName")
let per = 20
let page = 1
let token = localStorage.getItem("token")
axios.get("http://localhost:1337/api/v1/admin/user", {
    params: {
        per,
        page,
        userName,
        nickName
    },
    headers: {
        token
    }
}).then(r => {
    tableData.value = r.data.data
    console.log(tableData.value);

})
</script>

<style></style>